﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using GoShopping.BLL.SysInfo;
public partial class Member_GiftCard : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            GetRptData(Context.User.Identity.Name);
        }        
    }
    protected void rptGiftcard_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        GoShopping.Model.GiftCardUseContent gcuc = new GoShopping.Model.GiftCardUseContent();
        if (e.CommandName == "UUID")
        {
            GetLVData(e.CommandArgument.ToString());
            hidID.Value = e.CommandArgument.ToString();
        }
    }

    private void GetLVData(string filter)
    {
        GiftCardBean gcb = new GiftCardBean();
        lvSendHistory.DataSource = gcb.GetGiftCardContent(Convert.ToInt32(filter));
        lvSendHistory.DataBind();
    }
    private void GetRptData(string filter)
    {
        GiftCardBean gcb = new GiftCardBean();
        rptGiftcard.DataSource = gcb.GetUsersGiftCard(filter);
        rptGiftcard.DataBind();
    }

    protected void lvSendHistory_PagePropertiesChanging(object sender, PagePropertiesChangingEventArgs e)
    {
        ((DataPager)(this.lvSendHistory.FindControl("DataPager1"))).SetPageProperties(e.StartRowIndex, e.MaximumRows, false);
        GetLVData(hidID.Value);
    }
}
